void initGame()
{
  // define the screen size.  could be set to something smaller than the window to allow for hud space.
  thePlanets.setViewport( new boundingBox(new vec2d(),new vec2d(screenW, screenH)) );
  createGravityField();
  createObjs();

  myShip = new ship(new vec2d(gField.planets[0].position.x, gField.planets[0].position.y));
}

void createObjs()
{
  vecObjs = new Vector(numOfObjs);

  for(int i = 0;i< numOfObjs;i++)
  {
    float x = random(0,gField.gridW);
    float y = random(0,gField.gridH);
    
    float velX = 0; //random(objMinVel, objMaxVel);
    float velY = 0; //random(objMinVel, objMaxVel);
    
    float mass = random(objMinMass, objMaxMass);
 
    vecObjs.add(i, new asteroid(x, y, velX , velY, mass, appRef)); 
  }
}

void createGravityField()
{
  gField = new gravityField(screenH, screenW, gridRes,gridMacroRes, G);
  gField.generatePlanetsRandom(numOfPlanets, planetMinMass, planetMaxMass);
  gField.generateGravityField(); 
}
